import Vue from 'vue'
import Router from 'vue-router'

const Home = () => import('@/view/index/home');
const Detail = () => import('@/view/index/detail');

//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
Vue.use(Router)
const router = new Router({
  mode: 'history',
  base: '/',
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
    },
    {
      path: '/detail',
      name: 'Detail',
      component: Detail,
    }
    
     
    
  ],
  
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0}
  }
})


export default router;